import com.qingcheng.dao.BrandMapper;
import com.qingcheng.dao.SpecMapper;
import com.qingcheng.service.goods.CategoryService;
import com.qingcheng.utils.BCrypt;
import com.qingcheng.utils.CacheKey;
import org.elasticsearch.client.RestHighLevelClient;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
import java.util.Map;

/**
 * Created by yuanxin
 * Date:2019/7/10
 * Time:10:41
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath*:applicationContext*.xml")
public class test1 {
    @Autowired
    private RestHighLevelClient restHighLevelClient;
    @Autowired
    private BrandMapper brandMapper;
    @Autowired
    private SpecMapper specMapper;
    @Autowired
    private RedisTemplate redisTemplate;


    /**
    *
    */
    @Test
    public void test0(){
        List<Map> brandList = brandMapper.findListByCategoryName("真皮包");
        System.out.println(brandList);
        List<Map> specList = specMapper.findListByCategoryName("真皮包");
        System.out.println(specList);
    }
    /**
    *
    */
    @Test
    public void test2(){
        Map<String,Object> map = (Map<String, Object>) redisTemplate.boundHashOps(CacheKey.BRANDANDSPECLIST).get("手机");
        List<Map> brandList = (List<Map>) map.get("brandList");
        System.out.println(brandList);
        List<Map> specList = (List<Map>) map.get("specList");
        System.out.println(specList);
    }

    /**
    *
    */
    @Test
    public void test3(){
        String hashpw = BCrypt.hashpw("123456", BCrypt.gensalt());
        System.out.println(hashpw);
    }
}
